<%--
  Created by IntelliJ IDEA.
  User: PC
  Date: 2024/12/23 023
  Time: 15:59
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
    <head>
        <title>FileUpload.jsp</title>
        <script type="text/javascript">
            function refresh(object) {
                object.src = "${pageContext.request.contextPath}/captcha?time=" + new Date().getTime();
            }
        </script>
    </head>
    <body>
        <%-- 文件上传一定是POST请求，并enctype一定是multipart/form-data，且name的值source和后端接口形参MultipartFile source保持一致 --%>
        <form action="${pageContext.request.contextPath}/file/upload" method="post" enctype="multipart/form-data">
            <input type="file" name="source" /><br />
            <input type="submit" value="确认上传" />
        </form>
        <hr/>
        <%-- 文件下载 --%>
        <a href="${pageContext.request.contextPath}/file/download?fileName=9f4be216129048c484ae44d58abfcb53_reg_bg_min.jpg">下载文件</a>
        <hr/>
        <%-- 验证码 --%>
        <img src="${pageContext.request.contextPath}/captcha" alt="验证码" onclick="refresh(this)"/>
    </body>
</html>
